/**
 * @Author: xzm
 * @Date: 2019/9/11
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';
import { getUserId } from '@/assets/js/auth';

// 分页查询已建档经销商数据
export const getManagerList = (_params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager`, {params:_params,menuId:'-1'});
// 分页查询已建档经销商数据-大客户区域经理选择
export const getManagerSelectList = (_params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/select`,  {params:_params,menuId:'-1'});
// 查询大客户区域经理管理明细
export const getManagerById = (id) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/${id}`, {params:{id:id},menuId:'-1'});
// 保存大客户区域经理管理信息
export const insertManager = (params) => axios.post(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager`, params, {menuId:'-1'});
// 修改大客户区域经理管理信息
export const updateManager = (id,params) => axios.put(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/${id}`, params, {menuId:'-1'});
// 删除单条大客户区域经理管理信息
export const deleteManagerById = (id) => axios.delete(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/${id}`, {params:{id:id},menuId:'-1'});
// 批量删除大客户区域经理管理信息
export const deleteManagerByIds = (ids) => axios.delete(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/batch/${ids}`, {params:{ids:ids},menuId:'-1'});
// 分页查询大客户经理管辖经销商
export const getManageDealerList = (_params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManagerDealer`,  {params:_params,menuId:'-1'});
// 分页查询大客户经理管辖经销商（限制查询登录人所管辖经销商）
export const getManageDealerListFilter = (_params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManagerDealer/filter`,  {params:Object.assign({},_params,{"userId":getUserId()}),menuId:'-1'});
// 车厂端大客户线索查询导出（根据登录人区分大客户经理和其他角色查询）
export const exportManagerList = (params) => axios.post(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/export`, params,  { responseType: 'arraybuffer' ,menuId:'-1'});
// 获取大客户区域经理列表-如果登录人为区域经理，只返回该区域经理信息，非区域经理返回所有大客户区域经理
export const getFilterManager = (_params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/clue/majorManager/list`,  {params:_params,menuId:'-1'});